package jgl.vajra.kingkong.part.order.viewModel;

import java.util.Map;

import jgl.vajra.kingkong.bean.OrderEvaluateBean;
import jgl.vajra.kingkong.part.order.contract.OrderEvaluateContract;
import jgl.vajra.kingkong.part.order.model.OrderEvaluateModel;
import jgl.vajra.kingkong.widget.mvvm.factory.CreateModel;
import jgl.vajra.kingkong.widget.retrofithelper.rxsubscriber.ProgressObserver;

@CreateModel(OrderEvaluateModel.class)
public class OrderEvaluateViewModel extends OrderEvaluateContract.ViewModel{
    @Override
    public void getOrderEvaluateData(Map<String, Object> map) {
        mModel.getOrderEvaluateData(map).subscribe(new ProgressObserver<OrderEvaluateBean>(true,this) {
            @Override
            public void _onNext(OrderEvaluateBean data) {
                mView.returnOrderEvaluateBean(data);
            }

            @Override
            public void _onError(String errorMessage, int errorCode) {
                super._onError(errorMessage, errorCode);
            }
        });
    }

    @Override
    public void submitCommentsData(Map<String, Object> map) {
        mModel.submitCommentsData(map).subscribe(new ProgressObserver<Object>(true,this) {
            @Override
            public void _onNext(Object o) {
                mView.returnSubmitCommentsData();
            }

            @Override
            public void _onError(String errorMessage, int errorCode) {
                super._onError(errorMessage, errorCode);
            }
        });
    }
}
